#lang racket/load

(load "len.rkt")

(define (delta-list 1st-list 2nd-list)
  (cond
    [(check-list 1st-list 2nd-list) 
       (caculate-delta 1st-list 2nd-list)])
  )

(define (check-list 1st-list 2nd-list)
  (cond
    [(= (length 1st-list) (length 2nd-list)) true]
    [else false])
  )

(define (delta a b)
  (- a b)
  )

(define (caculate-delta 1st-list 2nd-list)
  (cond
    [(empty? 1st-list) empty]
    [else (cons (delta (first 1st-list) (first 2nd-list))
                (caculate-delta (rest 1st-list) (rest 2nd-list)))])
  )

; Test
(define first-list
  (cons 2.4
     (cons 1.8
       (cons 3.5
          (cons 4.5
             (cons 10.16
               (cons 5.4 empty)))))))

(define second-list
  (cons 1.4
     (cons 2.8
       (cons 3.1
          (cons 3.5
            (cons 11.16
               (cons 6.4 empty)))))))

(display (delta-list first-list second-list))
